package org.micro.test.core.configuration;

import org.micro.test.core.Constants;
import org.micro.test.core.servlet.APIHttpServlet;
import org.micro.test.core.servlet.PageHttpServlet;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MicroAutoConfiguration {

    @Bean
    public ServletRegistrationBean pageServletRegistration() {
        ServletRegistrationBean registration = new ServletRegistrationBean(new PageHttpServlet());
        registration.addUrlMappings(Constants.PAGE_URL);
        return registration;
    }

    @Bean
    public ServletRegistrationBean apiServletRegistration() {
        ServletRegistrationBean registration = new ServletRegistrationBean(new APIHttpServlet());
        registration.addUrlMappings(Constants.API_URL);
        return registration;
    }

}